<?php


/**
 * Base class that represents a query for the 'nieuws' table.
 *
 * 
 *
 * @method     NieuwsQuery orderByNieuwsid($order = Criteria::ASC) Order by the nieuwsID column
 * @method     NieuwsQuery orderByOnderwerp($order = Criteria::ASC) Order by the onderwerp column
 * @method     NieuwsQuery orderByTekst($order = Criteria::ASC) Order by the tekst column
 * @method     NieuwsQuery orderByDatum($order = Criteria::ASC) Order by the datum column
 *
 * @method     NieuwsQuery groupByNieuwsid() Group by the nieuwsID column
 * @method     NieuwsQuery groupByOnderwerp() Group by the onderwerp column
 * @method     NieuwsQuery groupByTekst() Group by the tekst column
 * @method     NieuwsQuery groupByDatum() Group by the datum column
 *
 * @method     NieuwsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method     NieuwsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method     NieuwsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method     Nieuws findOne(PropelPDO $con = null) Return the first Nieuws matching the query
 * @method     Nieuws findOneOrCreate(PropelPDO $con = null) Return the first Nieuws matching the query, or a new Nieuws object populated from the query conditions when no match is found
 *
 * @method     Nieuws findOneByNieuwsid(int $nieuwsID) Return the first Nieuws filtered by the nieuwsID column
 * @method     Nieuws findOneByOnderwerp(string $onderwerp) Return the first Nieuws filtered by the onderwerp column
 * @method     Nieuws findOneByTekst(string $tekst) Return the first Nieuws filtered by the tekst column
 * @method     Nieuws findOneByDatum(string $datum) Return the first Nieuws filtered by the datum column
 *
 * @method     array findByNieuwsid(int $nieuwsID) Return Nieuws objects filtered by the nieuwsID column
 * @method     array findByOnderwerp(string $onderwerp) Return Nieuws objects filtered by the onderwerp column
 * @method     array findByTekst(string $tekst) Return Nieuws objects filtered by the tekst column
 * @method     array findByDatum(string $datum) Return Nieuws objects filtered by the datum column
 *
 * @package    propel.generator.database.om
 */
abstract class BaseNieuwsQuery extends ModelCriteria
{

	/**
	 * Initializes internal state of BaseNieuwsQuery object.
	 *
	 * @param     string $dbName The dabase name
	 * @param     string $modelName The phpName of a model, e.g. 'Book'
	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
	 */
	public function __construct($dbName = 'database', $modelName = 'Nieuws', $modelAlias = null)
	{
		parent::__construct($dbName, $modelName, $modelAlias);
	}

	/**
	 * Returns a new NieuwsQuery object.
	 *
	 * @param     string $modelAlias The alias of a model in the query
	 * @param     Criteria $criteria Optional Criteria to build the query from
	 *
	 * @return    NieuwsQuery
	 */
	public static function create($modelAlias = null, $criteria = null)
	{
		if ($criteria instanceof NieuwsQuery) {
			return $criteria;
		}
		$query = new NieuwsQuery();
		if (null !== $modelAlias) {
			$query->setModelAlias($modelAlias);
		}
		if ($criteria instanceof Criteria) {
			$query->mergeWith($criteria);
		}
		return $query;
	}

	/**
	 * Find object by primary key
	 * Use instance pooling to avoid a database query if the object exists
	 * <code>
	 * $obj  = $c->findPk(12, $con);
	 * </code>
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    Nieuws|array|mixed the result, formatted by the current formatter
	 */
	public function findPk($key, $con = null)
	{
		if ((null !== ($obj = NieuwsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
			// the object is alredy in the instance pool
			return $obj;
		} else {
			// the object has not been requested yet, or the formatter is not an object formatter
			$criteria = $this->isKeepQuery() ? clone $this : $this;
			$stmt = $criteria
				->filterByPrimaryKey($key)
				->getSelectStatement($con);
			return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
		}
	}

	/**
	 * Find objects by primary key
	 * <code>
	 * $objs = $c->findPks(array(12, 56, 832), $con);
	 * </code>
	 * @param     array $keys Primary keys to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
	 */
	public function findPks($keys, $con = null)
	{	
		$criteria = $this->isKeepQuery() ? clone $this : $this;
		return $this
			->filterByPrimaryKeys($keys)
			->find($con);
	}

	/**
	 * Filter the query by primary key
	 *
	 * @param     mixed $key Primary key to use for the query
	 *
	 * @return    NieuwsQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKey($key)
	{
		return $this->addUsingAlias(NieuwsPeer::NIEUWSID, $key, Criteria::EQUAL);
	}

	/**
	 * Filter the query by a list of primary keys
	 *
	 * @param     array $keys The list of primary key to use for the query
	 *
	 * @return    NieuwsQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKeys($keys)
	{
		return $this->addUsingAlias(NieuwsPeer::NIEUWSID, $keys, Criteria::IN);
	}

	/**
	 * Filter the query on the nieuwsID column
	 * 
	 * @param     int|array $nieuwsid The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    NieuwsQuery The current query, for fluid interface
	 */
	public function filterByNieuwsid($nieuwsid = null, $comparison = null)
	{
		if (is_array($nieuwsid) && null === $comparison) {
			$comparison = Criteria::IN;
		}
		return $this->addUsingAlias(NieuwsPeer::NIEUWSID, $nieuwsid, $comparison);
	}

	/**
	 * Filter the query on the onderwerp column
	 * 
	 * @param     string $onderwerp The value to use as filter.
	 *            Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    NieuwsQuery The current query, for fluid interface
	 */
	public function filterByOnderwerp($onderwerp = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($onderwerp)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $onderwerp)) {
				$onderwerp = str_replace('*', '%', $onderwerp);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(NieuwsPeer::ONDERWERP, $onderwerp, $comparison);
	}

	/**
	 * Filter the query on the tekst column
	 * 
	 * @param     string $tekst The value to use as filter.
	 *            Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    NieuwsQuery The current query, for fluid interface
	 */
	public function filterByTekst($tekst = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($tekst)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $tekst)) {
				$tekst = str_replace('*', '%', $tekst);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(NieuwsPeer::TEKST, $tekst, $comparison);
	}

	/**
	 * Filter the query on the datum column
	 * 
	 * @param     string|array $datum The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    NieuwsQuery The current query, for fluid interface
	 */
	public function filterByDatum($datum = null, $comparison = null)
	{
		if (is_array($datum)) {
			$useMinMax = false;
			if (isset($datum['min'])) {
				$this->addUsingAlias(NieuwsPeer::DATUM, $datum['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($datum['max'])) {
				$this->addUsingAlias(NieuwsPeer::DATUM, $datum['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(NieuwsPeer::DATUM, $datum, $comparison);
	}

	/**
	 * Exclude object from result
	 *
	 * @param     Nieuws $nieuws Object to remove from the list of results
	 *
	 * @return    NieuwsQuery The current query, for fluid interface
	 */
	public function prune($nieuws = null)
	{
		if ($nieuws) {
			$this->addUsingAlias(NieuwsPeer::NIEUWSID, $nieuws->getNieuwsid(), Criteria::NOT_EQUAL);
	  }
	  
		return $this;
	}

} // BaseNieuwsQuery
